import 'package:flutter/material.dart';
import 'package:flutter_mvvm/base/base_mvvm.dart';
import 'package:flutter_mvvm/vm/test_view_model.dart';

class TestPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _TestPageState();
}

class _TestPageState extends BaseState<TestPage> {
  @override
  Widget build(BuildContext context) {
    return BaseView<TestViewModel>(
      viewModel: TestViewModel(),
      onViewModelCreated: (TestViewModel viewModel) {},
      builder: (context, viewModel) {
        return Scaffold(
          appBar: AppBar(
            title: Text("Flutter MVVM Demo"),
            centerTitle: true,
          ),
          body: Center(child: Text("${viewModel.number}")),
          floatingActionButton: FloatingActionButton(
            tooltip: "add",
            onPressed: () => viewModel.addNumber(),
          ),
        );
      },
    );
  }
}
